<template>
  <view class="join-mask" v-if="show" @click ="handleMaskClick">
    <view class="join-content" @click.stop>
      <!-- 标题区域 -->
      <view class="join-header">
        <text class="join-title">注册成功</text>
        <text class="join-subtitle">请加入您的组织以使用全部功能</text>
      </view>

      <!-- 按钮区域 -->
      <view class="join-button-wrap">
        <button class="gvr-yellow-button" @click="handleJoinOrg">
          加入组织
        </button>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

const show = ref(false)
const emit = defineEmits(['joinOrg'])

// 打开弹窗
const open = () => {
  show.value = true
}

// 关闭弹窗
const close = () => {
  show.value = false
}

// 处理蒙版点击
const handleMaskClick = () => {
  // 点击蒙版不关闭
   show.value = false 
   emit('close')
}

// 处理加入组织按钮点击
const handleJoinOrg = () => {
  close()
  emit('joinOrg')
}

// 对外暴露方法
defineExpose({
  open,
  close
})
</script>

<style scoped>
.join-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.join-content {
  margin: 0 76rpx;
  background: #FFFFFF;
  padding: 72rpx 64rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 100000;
}

.join-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.join-title {
  font-family: PingFangSC-Medium;
  font-size: 36rpx;
  color: #000000;
  letter-spacing: 0;
  text-align: center;
  font-weight: 500;

}

.join-subtitle {
  font-family: PingFangSC-Medium;
  font-size: 28rpx;
  color: #000000;
  letter-spacing: 0;
  text-align: center;
  font-weight: 500;
}

.join-button-wrap {
  margin-top: 40rpx;
  width: 100%;
}

</style>